package net.forsuber.data;

/**
 * User: lzap
 * Date: 25.7.2007
 * Time: 22:26:09
 */
public interface DataSource {

    /**
     * Opens connection (sourceFile etc).
     *
     * @throws DataSourceException on error
     */
    public void open() throws DataSourceException;

    /**
     * Size of all records. Note the data can grow in time.
     *
     * @return integer greater than zero
     */
    public int size();

    /**
     * Gets record under this index (0-n).
     *
     * @param index index greater than zero
     * @return the record implementation
     */
    public Record getRecord(final int index);

    /**
     * Close database connection etc.
     *
     * @throws DataSourceException on error
     */
    public void close() throws DataSourceException;
}
